package cn.itcast.com.IO.zifuliu.introduction;

import java.io.*;

//D:\代码\代码\代码\cn\itcast\com\IO
public class demo3 {
    public static void main(String[] args) throws IOException {
        String s = "你好，舔🐕";
        FileOutputStream fileOutputStream = new FileOutputStream("D:\\代码\\代码\\代码\\cn\\itcast\\com\\IO\\a.txt",true);
        Writer writer = new OutputStreamWriter(fileOutputStream, "utf-8");
//        //向文件写入
//        //一个一个的传
//        char[] chars = s.toCharArray();
//        for (int i = 0; i < chars.length; i++) {
//            writer.write(chars[i]);
//        }
//        //一次传入一个数组
//        char[] chars = s.toCharArray();
//        writer.write(chars);
        writer.write(s,0,s.length()-1);

        writer.close();
    }

}
